<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [

    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        // 定时任务 两种写法
        //$schedule->command('cron:testCast jobCast --relation=jobProd')->cron('* * * * *');
        //$schedule->command('cron:testCast jobCast --relation=jobProd')->everyMinute();

        // 每五分钟执行一次话题热度统计
        $schedule->command('cron:topic')->cron('*/5 * * * *')->onOneServer();

    }

    /**
     * Register the commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load([__DIR__.'/Commands', __DIR__.'/Scripts']);

        require base_path('routes/console.php');
    }
}
